package com.livace.doctool.pdf.presentation;

import com.livace.doctool.pdf.application.PdfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Optional;

@RestController
@RequestMapping("api/v1.0/pdf-docs")
public class PdfController {

    @Autowired
    private PdfService pdfService;


    @PostMapping("/split")
    public ResponseEntity<String> split(@RequestParam MultipartFile file) {
        Optional<String> filePath = pdfService.generateByLingMa(file);
        return ResponseEntity.of(filePath);
    }

}
